package com.happystreet.info
{
	import com.happystreet.config.GameConfig;
	import com.happystreet.config.GoodsConfig;
	import com.happystreet.config.MaterialsConfig;
	import com.happystreet.utils.CustomUtils;

	public class UpgradeInfo
	{
		public var materialId:int;
		public var currency:String;
		public var materialName:String;
		public var currencySymbolName:String;
		public var cost:int;
		public function UpgradeInfo(coins:String,num:int)
		{
			this.cost = num;
			switch (coins)
			{
				case GameConfig.COINS_CURRENCY:
					this.currency = coins;
					this.currencySymbolName = "CoinIcon";
					return;
				case GameConfig.CASH_CURRENCY:
					this.currency = coins;
					this.currencySymbolName = "CashIcon";
					return;
				default:
					this.currency = GoodInfo.MATERIAL_CURRENCY;
					this.materialId = int(coins);
					this.materialName = MaterialsConfig.getMaterialNameById(this.materialId);
					this.currencySymbolName = MaterialsConfig.getMaterialSymbolNameById(this.materialId);
			}
		}
		
		public function get text():String
		{
			if (this.currency == GoodInfo.MATERIAL_CURRENCY)
			{
				return String(GoodsConfig.getMaterialStockById(this.materialId) + "/" + this.cost);
			}
			return CustomUtils.formatBigNumbers(this.cost);
		}
	}
}